package drds.binlog.spi;

import drds.binlog.instance.core.BinlogTask;

/**
 * BinlogTaskInfo server/instance metrics for export.
 * <strong>
 * Designed to be created by service provider.
 * </strong>
 */
public interface MetricsService
{

    /**
     * Initialization on canal server startup.
     */
    void initialize();

    /**
     * Clean-up at canal server stop phase.
     */
    void terminate();

    /**
     * @return {@code true} if the metrics service is running, otherwise {@code false}.
     */
    boolean isRunning();

    /**
     * Register binlogTask level metrics for specified binlogTask.
     *
     * @param binlogTask {@link BinlogTask}
     */
    void register(BinlogTask binlogTask);

    /**
     * Unregister binlogTask level metrics for specified binlogTask.
     *
     * @param binlogTask {@link BinlogTask}
     */
    void unregister(BinlogTask binlogTask);

    /**
     * @param port server port for pull
     */
    void setServerPort(int port);

}
